import pyautogui as pg


def click(image_path, confidence) -> tuple:
    """
    点击图片的中心坐标
    :param image_path: 图片的路径
    :param confidence: 相似度
    :return:
    """
    image_location = pg.locateOnScreen(image=image_path, confidence=confidence)
    pg.leftClick(pg.center(tuple[int, int, int, int](image_location)))


def click(x, y):
    """
    鼠标左键点击坐标位置
    :param x: 横坐标点
    :param y: 纵坐标点
    :return:
    """
    pg.leftClick(x=x, y=y)


def img_exist(image_path, confidence):
    """
    返回是否在页面找到识别的图像
    :param image_path: 图片地址
    :param confidence: 图片相似度
    :return: 图片是否在页面存在，存在为True，不存在返回False
    """
    if pg.locateOnScreen(image=image_path, confidence=confidence):
        return True
    else:
        return False

